<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="/css/layui.css">
    <link rel="stylesheet" href="/css/bootstrap.min.css">
</head>

<body>

    <h2 style="margin-top: 30px;">问卷填写😀</h2>
    <br>


    <div>

        <form>
            <div class="cordrow" style="color:darkmagenta; font-size: 22px;">问卷题目1:{{questions.que1}}</div>
            <input type="number" class="form-control" id="exampleFormControlInput1" placeholder="请对问题进行打分1~10"
                style="width: 500px;">
            <div class="cordrow" style="color:darkmagenta; font-size: 22px;">问卷题目2:{{questions.que2}}</div>
            <input type="number" class="form-control" id="exampleFormControlInput2" placeholder="请对问题进行打分1~10"
                style="width: 500px;">
            <div class="cordrow" style="color:darkmagenta; font-size: 22px;">问卷题目3:{{questions.que3}}</div>
            <input type="number" class="form-control" id="exampleFormControlInput3" placeholder="请对问题进行打分1~10"
                style="width: 500px;">
            <div class="cordrow" style="color:darkmagenta; font-size: 22px;"> 问卷题目4:{{questions.que4}}</div>
            <input type="number" class="form-control" id="exampleFormControlInput4" placeholder="请对问题进行打分1~10"
                style="width: 500px;">
            <div class="cordrow" style="color:darkmagenta; font-size: 22px;">问卷题目5:{{questions.que5}}</div>
            <input type="number" class="form-control" id="exampleFormControlInput5" placeholder="请对问题进行打分1~10"
                style="width: 500px;">


        </form>

        <a href="javascript:void(0);" style="margin-top: 30px; margin-left: 20px;" class="btn btn-primary btn-lg active"
            onclick="tijiao('{{questions.id}}')" role="button" aria-pressed="true">提交</a>



    </div>




</body>



<script src="/js/jquery-3.6.0.min.js"></script>
<script src="/layui.js"></script>


<script>

    function tijiao(questionId) {
    
        let data = {
            surId: questionId,
            sco1: parseInt($('#exampleFormControlInput1').val()),
            sco2: parseInt($('#exampleFormControlInput2').val()),
            sco3: parseInt($('#exampleFormControlInput3').val()),
            sco4: parseInt($('#exampleFormControlInput4').val()),
            sco5: parseInt($('#exampleFormControlInput5').val()),
        }

        $.ajax({
            url: "/addscore",
            type: "POST",
            data: data,
            dataType: "json",
            success: function (res) {
                console.log(res);
                if (res.code === 200) {
                    window.location.href = "/frontdesk";
                }
                else {
                    alert_fn(res.msg);
                }

            },
            error: function (msg) {
                alert_fn('网络或者服务器有问题');
            }
        })
    }
</script>

</html>